require_relative 'directive_groups/base'
require_relative 'directive_groups/httpd'
require_relative 'directive_groups/virtual_host'
require_relative 'directive_groups/directory'
require_relative 'directive_groups/generic_directive_group'

module Tomahawk
  module DirectiveGroups
    extend self

    def DirectiveGroup(directive_group_name)
      directive_group_name = String(directive_group_name)

      Tomahawk::DirectiveGroups.const_get(directive_group_name)
    rescue NameError
      Class.new(Tomahawk::DirectiveGroups::GenericDirectiveGroup) do
        define_method(:name) { directive_group_name }
      end
    end
  end
end
